<template><!-- 店铺详情 -->
  <div class="my-invoice-detail">  
    <row title="店铺名称"  :value="detail.storeName"></row>
    <row title="店铺地址"  :value="detail.province + detail.city + detail.district + detail.address"></row>
    <row title="联系人"  :value="detail.contacts" placeholder="未设置"></row>
    <row title="联系电话"  :value="detail.telephone" placeholder="未设置"></row>
    <!-- <row title="是否开启外卖"  :value="detail.takeOut?'是':'否'" placeholder="未设置"></row> -->
    <row title="今日是否营业" v-if="detail.type == 3" :value="detail.open ? '营业中' : '未开启'" placeholder="未设置"></row>
    <row title="是否开启堂食" v-if="detail.type == 3"  :value="detail.dine ? '是' : '否'" placeholder="未设置"></row> 
    <row title="是否开启外卖" v-if="detail.type==3"  :value="detail.takeOut ? '是' : '否'" placeholder="未设置"></row>
    <row title="最大配送距离(km)" v-if="detail.takeOut "  :value="detail.expressRange" placeholder="未设置"></row>
    <row title="最低收取配送费公里数(km)" v-if="detail.takeOut"  :value="detail.chargeRange" placeholder="未设置"></row>
    <row title="配送费(元)" v-if="detail.takeOut"  :value="detail.expressPrice" placeholder="未设置"></row>
    <row title="营业时间(当天)" v-if="detail.type == 3"  :value="detail.openTime" placeholder="未设置"></row>  
    <row title="营业时间(次日)" v-if="detail.nextEndTime && detail.type == 3"   :value="detail.nextStartTime + '-' + detail.nextEndTime"  > </row>
    <div v-if="detail.takeoutTime && detail.takeOut">   
        <row :title="'配送时段'+(index+1)"  v-for="(item,index) in detail.takeoutTime"  :key="index" :value="item.startTime + '-' + item.endTime" placeholder="未设置"></row>  
    </div>
    <div class="height50"></div>
    <div class="btn-box">   
        <div class="isbtn rightline" @click="goChange">修改</div>
        <div class="isbtn rightline" @click="goStockList()">库存盘点</div>
        <div class="isbtn rightline" @click="goOrder">查看销售</div>
        <div class="isbtn rightline" @click="goFoodMng()">菜品管理</div>
    </div>
  </div>
</template>

<script>
import row from '@/components/row'
import api from '@/api/api.js' 
import { Confirm } from 'vux'
export default { 
  components: {
    row,
    Confirm
  },
  data () {
    return {
        confirm:{
            content:'',
            title:'',
        },
        confirm_show:false,
      detail:{ 
          
      }
    }
  },
  mounted () {
    this.getDetail( this.$route.query.id );
  },
  filters: {
     
  },
  methods: {
    // //冻结 解冻
    // optAction(idx){
    //     if(this.idx==1){//执行冻结
    //         this.setStoreAdminStatus('0')
    //       }else if(this.idx==2){//解除冻结
    //         this.setStoreAdminStatus(1)
    //       }
    // },
    goStockList(){
        this.$router.push({path:'/shopkeeperStockList',query:{ id: this.$route.query.id,type:1 }})
    },
    goOrder(){
        this.$router.push({path:"/saleOrder",query:{id:this.$route.query.id}})
    },
    
    //修改店铺
    goChange(){
        // this.$store.commit("setWarehouseList",[]);
        this.$router.push({path:'/shopkeeperShopEdit',query:{ id: this.$route.query.id }})
    },
    goFoodMng(){
        this.$router.push({path:'/foodList',query:{ id: this.$route.query.id }})
    },
    // 获取详情
    getDetail(id){
        api.shopMng.shopDetail({
            "storeId": id
        },res=>{
            console.log(res);
            if(res.result.licensePics.indexOf(",")!=-1){
                res.result.licensePics =  res.result.licensePics.split(",");
            }else{
                res.result.licensePics = res.result.licensePics? [res.result.licensePics] : [];
            }
            if(res.result.deviceQrpics.indexOf(",")!=-1){
                res.result.deviceQrpics =  res.result.deviceQrpics.split(",");
            }else{
                res.result.deviceQrpics = res.result.deviceQrpics ? [res.result.deviceQrpics] : [];
            }
            if(res.result.storePics.indexOf(",")!=-1){
                res.result.storePics =  res.result.storePics.split(",");
            }else{
                res.result.storePics = res.result.storePics ? [res.result.storePics] : [];
            }
            this.detail = res.result;
        })

    }
  }
}
</script>
<style lang="less" scoped>
.height50{
    height: 50px;
}
.invoice-photo{
    padding: 12px 16px;
}
.map-title{
    height: 40px;
    line-height: 40px;
    font-size: 16px;
    font-weight: bold;
}
.invoice-photo-img{
   width: 100%;
   min-width: 74px;
   min-height: 74px;
   background: #ccc;
}
.invoice-order{
    display: flex;
    height: 40px;
    line-height: 40px;

}
.invoice-number{
    color: #444;
    width: 35%;
    padding-left: 8px;
}
.tips{
    color: #999;
    font-size: 11px;
    margin-left: 8px;
}
.invoice-money{
    color: #999;
    width: 30%;
}
.invoice-timer{
   color: #666; 
   width: 35%;
}
.invoice-active{
    background: #e1e1e1;
}
.wrap-box{
    display: flex;
    flex-wrap: wrap;
    img{
        margin-bottom: 10px;
        margin-right: 10px;
        width: 74px;
        height: 74px;
        background: #bbb;    }
}
.btn-box{
    display: flex;
    background: #fff;
    height: 50px;
    box-sizing: border-box;
    position: fixed;
    box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.06);;
    bottom: 0;
    left: 0;
    right: 0;
    &>div{
        flex: 1;
        text-align: center;
        line-height: 50px;
    }
    .rightline{
        position: relative;
        &::before{
            content: '';
            right: 0;
            top: 18px;
            position: absolute;
            bottom: 18px;
            width: 1px;
            background: #e1e1e1;
        }
    }

}
</style>
